//
// Copyright (c) 2024 BPer
//
#ifndef SRC_BPERRTP_BPERRTPPACKET_H_
#define SRC_BPERRTP_BPERRTPPACKET_H_

#include <bperrtp/BPerRtpBuffer.h>
#include <bperrtp/BPerRtpHeader.h>

#include <bperutil/BPerAvType.h>
#include <bperutil/buffer/BPerBuffer.h>

typedef struct BPerRtpPacket{
	    int32_t actual_buffer_size;
	    int32_t nalu_type;
	    int32_t frame_type;
	    BPerRtpPacketPayloadType payload_type;
	    int32_t nb;
	    int32_t cached_payload_size;  // The cached payload size for packet.
	    char* payload;
	    BPerRtpHeader header;
}BPerRtpPacket;

#ifdef __cplusplus
extern "C"{
#endif

void bPer_create_rtpPacket(BPerRtpPacket* pkt);
void bPer_destroy_rtpPacket(BPerRtpPacket* pkt);
void bPer_reset_rtpPacket(BPerRtpPacket* pkt);
int32_t bPer_decode_rtpPacket(BPerRtpPacket* pkt,BPerBuffer *buf);
int32_t bPer_encode_rtppayload(BPerRtpPacket* pkt,BPerBuffer *buf);
char* bPer_wrap_rtpPacket(BPerRtpPacket* pkt,BPerRtpBuffer* rtpb,char* data,int32_t nb);
void bPer_rtpPacket_set_padding(BPerRtpPacket* pkt,int32_t size);
void bPer_rtpPacket_add_padding(BPerRtpPacket* pkt,int32_t size) ;
#ifdef __cplusplus
}
#endif
#endif /* SRC_BPERRTP_BPERRTPPACKET_H_ */
